function out_points = readdata(file,norm)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% -input args:
%     file: txt格式文件
%     norm: norm为1时，将对x,y,z坐标归一化。
% -output args:
%     out_points: n*5的矩阵。n为点云个数，五个分量分别为[x,y,z,index,class]
%     index记录点云的原始序列，用于之后排序后的索引。class记录预处理中的分类信息，0为背景点，1为塔或线点
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    disp('Reading data from file...');
    a = importdata(file);
    points = zeros(length(a),5);
    points(:,1:3) = a(:,1:3);
    minx = min(points(:,1));
    maxx = max(points(:,1));
    miny = min(points(:,2));
    maxy = max(points(:,2));
    minz = min(points(:,3));
    maxz = max(points(:,3));
    points(:,4) = 1:length(points);
    points(:,5) = 0;
    if norm==0
        out_points = points;
    else
        out_points(:,1) = (points(:,1)-minx)/(maxx-minx);
        out_points(:,2) = (points(:,2)-miny)/(maxy-miny);
        out_points(:,3) = (points(:,3)-minz)/(maxz-minz);
        out_points(:,4:5) = points(:,4:5);
        
    end  
end